﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html {
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }

        #l-map {
            height: 400px;
            width: 100%;
        }

        #r-result {
            width: 100%;
            font-size: 14px;
            line-height: 20px;
        }
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=NVpVKdH67Id8f94IDAFX9nHXOGW58Abt"></script>
    
    <title>集货调度</title>
</head>
<body>
    <div  ms-controller="tempview">
        <label class="control-label"><b style="color: #f00;">*</b>订单详情</label>
        <div class="controls">

            <table class="sui-table table-primary table-zebra">
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>装车地址</th>
                        <!--<th>卸货地址</th>-->



                    </tr>
                </thead>
                <tbody>
                    <tr ms-repeat-el="ListData">
                        <td>el.ORDERID</td>
                        <td>el.PUTONADD</td>
                        <!--<td>福建万达华府9幢21号</td>-->
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div>
        <label class="control-label"><b style="color: #f00;">*</b>输入车牌：</label>
        <input type="text" />
    </div>
    <br />
    <div id="l-map"></div>
    <div id="r-result">
        <input type="button" value="查看装货信息" onclick="bdGEO()" />
        <div id="result"></div>
    </div>
</body>
</html>
<script type="text/javascript">

   
    function getParam(paramName) {
        paramValue = "", isFound = !1;
        if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
            arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
            while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
        }
        return paramValue == "" && (paramValue = null), paramValue
    };
    // alert(getParam("order"));
    var orderid = getParam("order");
    var beginadd = getParam("beginadd");

    // 百度地图API功能
    var map = new BMap.Map("l-map");
    map.centerAndZoom(new BMap.Point(118.68127, 24.881026), 15);
    map.enableScrollWheelZoom(true);
    var index = 0;
    var myGeo = new BMap.Geocoder();
    var adds = [
        "泉州市人民政府",
        "泉州星宿客栈",
        "泉州东海湾实验学校",
        "鸡笼山 ",
        "泉州市旅游局",
        "海星小区",
        "宝秀小区",
        "泉州迎宾馆"
    ];
    function bdGEO() {
        var add = adds[index];
        geocodeSearch(add);
        index++;
    }
    function geocodeSearch(add) {
        if (index < adds.length) {
            setTimeout(window.bdGEO, 400);
        }
        myGeo.getPoint(add, function (point) {
            if (point) {
                document.getElementById("result").innerHTML += index + "、" + add + ":" + point.lng + "," + point.lat + "</br>";
                var address = new BMap.Point(point.lng, point.lat);
                addMarker(address, new BMap.Label(index + ":" + add, { offset: new BMap.Size(20, -10) }));
            }
        }, "泉州市");
    }
    // 编写自定义函数,创建标注
    function addMarker(point, label) {
        var marker = new BMap.Marker(point);
        map.addOverlay(marker);
        marker.setLabel(label);
    }
   // bdGEO()
</script>


<script type="text/javascript">

    function getParam(paramName) {
        paramValue = "", isFound = !1;
        if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
            arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
            while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
        }
        return paramValue == "" && (paramValue = null), paramValue
    };
    // alert(getParam("order"));
    var orderid = getParam("order");
    var beginadd = getParam("beginadd");


    var tempmodel = avalon.define({
        $id: "tempview",
        Type1: "",
        Type2: "",
        TypeList1: [],
        TypeList2: [],
        IsShelf: "",
        ToTop: "",
        Init: function () {
            $.getJSON("/adapi/base/order/list", function (r) {
                tempmodel.TypeList1 = r.result;
            })
            tempmodel.GetLIST();
        },
        GetLIST: function () {
            model.page.pageindex = 1;
            model.ListData.clear();
            alert(orderid);
            $.getJSON("/adapi/base/order/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize, "searchkey": orderid }, function (r) {
                if (r.error == "") {
                    model.ListData = r.result;
                    model.total = r.total;

                    alert(r.result);

                    $("#pageDiv").pagination({  //分页容器
                        styleClass: ['sui-pagination'],  //分页样式
                        //showCtrl: false,
                        displayPage: 6,
                        itemsCount: r.total,
                        pageSize: model.page.pagesize,
                        onSelect: function (num) {
                            model.page.pageindex = num;
                            $.getJSON("/adapi/product/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize, "searchkey": model.searchkey, "Type1": tempmodel.Type1, "Type2": tempmodel.Type2, "IsShelf": tempmodel.IsShelf, "ToTop": tempmodel.ToTop }, function (r) {
                                model.ListData.clear();
                                model.ListData = r.result;
                            })
                        }
                    })

                    $('#pageDiv').pagination('updateItemsCount', r.total, 1);
                }
            })
        }


    })

    tempmodel.$watch("Type1", function () {
        tempmodel.TypeList2.clear();
        tempmodel.Type2 = "";
        if (tempmodel.Type1) {
            $.getJSON("/adapi/base/cate/list/1/" + tempmodel.Type1, function (r) {
                tempmodel.TypeList2 = r.result;
            })
        }

    })


</script>

